const express = require('express');
const app = express();

app.set('secret', 'asdhksh2323sad');
app.use(require('cors')()) //跨域
app.use(express.json())
// 静态文件托管
app.use('/public', express.static(__dirname + '/public'))
app.use('/admin', express.static(__dirname + '/admin'))
app.use('/', express.static(__dirname + '/web')) //把web文件夹托管到根路径


require('./routers/admin')(app)
require('./routers/web')(app)
require('./plugins/db')(app)


// 端口号
let port = 3000
app.listen(port, () => {
    console.log(`http://localhost:${port}`);
})